﻿using Client.Constant;
using Client.Framework.Message;
using Client.Model;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.Message.Response
{
    [MessageAttr(MessageId.RESPONSE_ALL_ROLES)]
    class AllRolesResp : ResponseBaseMessage
    {
        public List<ViewRole> Roles { get; private set; } = new List<ViewRole>();

        public override void Deserialize(byte[] buffer)
        {
            ResponseAllRoles msg = ResponseAllRoles.Parser.ParseFrom(buffer);
            foreach (var role in msg.Roles)
            {
                ViewRole r = new ViewRole
                {
                    ID = role.Id,
                    RoleName = role.RoleName
                };
                Roles.Add(r);
            }
        }
    }
}
